<!DOCTYPE html>

<html>

<head>
    <title></title>
    <script src='../vue.js'></script>
</head>

<body>
    <div id="app-14">
        <keep-alive>
            <component v-bind:is="currentView">
                <!-- 组件在 vm.currentview 变化时改变！ -->
            </component>
        </keep-alive>
        <input v-model="currentView" />
    </div>
    <script>
        var vm = new Vue({
            el: '#app-14',
            data: {
                currentView: 'home'
            },
            components: {
                home: {
                    template: '<span>home component</span>'
                },
                posts: {
                    template: '<span>posts component</span>'
                },
                archive: {
                    template: '<span>archive component</span>'
                }
            }
        })
    </script>
</body>


</html>